Sanitize credentials in Docker command logs#419
Merged
Conversation
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix credential leakage in launch command logs
Sanitize credentials in Docker command logs
Jan 22, 2026
This was referenced Jan 22, 2026
9 tasks
This was referenced Jan 22, 2026
This was referenced Jan 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Docker environment variables containing secrets (e.g.,
GITHUB_PERSONAL_ACCESS_TOKEN=ghp_xxx...) were being logged in plaintext when launching MCP backend servers.Changes
Added
SanitizeArgs()function (internal/logger/sanitize/sanitize.go)-e VAR=VALUEpatterns in Docker argsTruncateSecret()(shows first 4 chars + "...")Updated logging statements to sanitize args before output:
internal/launcher/launcher.go: 4 locations (GetOrLaunch, GetOrLaunchForSession)internal/mcp/connection.go: 5 locations (NewConnection, startup, error paths)Test coverage: 13 test cases including dedicated leak detection test
Example
Before:
After:
Variable names remain visible for debugging while values are safely truncated.
Warning
GitHub's Secret Scanning detected potential secrets in the added content. We attempted to remediate the issue by updating the code or redacting.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
this-host-does-not-exist-12345.com/tmp/go-build3753664088/b278/mcp.test /tmp/go-build3753664088/b278/mcp.test -test.testlogfile=/tmp/go-build3753664088/b278/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true -c=4 -nolocalimports -importcfg /tmp/go-build3753664088/b243/importcfg -pack /home/REDACTED/go/pkg/mod/github.com/modelcontextprotocol/go-sdk@v1.1.0/internal/util/util.go 64/pkg/include ortc�� 64/src/runtime/cgo 64/src/weak/doc.go ache/go/1.25.5/x64/pkg/tool/linu-o pull.rebase(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.